Java syntax
part 7/46 · 86.7 KB total
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
* @author John Doe
*/
Universal types
Classes in the package java.lang are implicitly imported into every program, as long as no explicitly-imported types have the same names. Important ones include:
java.lang.Object
java.lang.Object is Java's top type. It is implicitly the superclass of all classes that do not declare any parent class (thus all classes in Java inherent from Object. All values can be converted to this type, although for primitive values this involves autoboxing.
java.lang.String
java.lang.Throwable
java.lang.Throwable is supertype of everything that can be thrown or caught with Java's throw and catch statements.
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────